SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_UpdateAdminInfo]
    (
      @fdAdminLoginID VARCHAR(50) ,
      @fdAdminPwd VARCHAR(50) ,
      @fdAdminName VARCHAR(50) ,
      @fdAdminMobile VARCHAR(20) ,
      @fdAdminEmail VARCHAR(50) ,
      @fdAdminPhone VARCHAR(20) ,
      @fdAdminStatus BIT ,
      @fdAdminUpdateTime DATETIME ,
      @fdAdminUpdateLoginID VARCHAR(50)
    )
AS 
    DECLARE @Count INT ,
        @Pwd VARCHAR(50)
    SET @Count = ( SELECT   COUNT(fdAdminLoginID)
                   FROM     dbo.JOL_Admin
                   WHERE    fdAdminLoginID = @fdAdminLoginID
                 )
    SET @Pwd = ( SELECT fdAdminPwd
                 FROM   dbo.JOL_Admin
                 WHERE  fdAdminLoginID = @fdAdminLoginID
               )
    IF @Count > 0 
        UPDATE  dbo.JOL_Admin
        SET     fdAdminPwd = CASE @fdAdminPwd
                               WHEN '' THEN @Pwd
                               ELSE @fdAdminPwd
                             END ,
                fdAdminName = @fdAdminName ,
                fdAdminMobile = @fdAdminMobile ,
                fdAdminEmail = @fdAdminEmail ,
                fdAdminPhone = @fdAdminPhone ,
                fdAdminStatus = @fdAdminStatus ,
                fdAdminUpdateTime = @fdAdminUpdateTime ,
                fdAdminUpdateLoginID = @fdAdminUpdateLoginID
        WHERE   fdAdminLoginID = @fdAdminLoginID
    ELSE 
        SELECT  '不存在要修改的账号'
GO
